package cn.edu.dgut.sai;

import javax.servlet.FilterChain;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Sai
 * Created by Sai on 2019/8/28.
 *
 * 在浏览器测试：
 * http://localhost:8080/webapp-demo/error
 */
@WebFilter(filterName = "testErrorFilter", urlPatterns = "/error")
public class TestErrorFilter extends HttpFilter {
    @Override
    protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain chain) {
        throw new RuntimeException("主动抛一个运行时异常");
    }
}
